<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require 'dbcon.php';
$username=$_REQUEST['username'];
$content=$_REQUEST['content'];
date_default_timezone_set('Asia/Shanghai');
$wdate=date("Y-m-d h:i:s");
$sql="INSERT INTO tb_wish(username,content,wdate) VALUES( '{$username}', '{$content}','{$wdate}')";
$rs=$db->query($sql);//执行查询语句$sql，生成结果集$result
$db->close();//关闭数据库连接
if ($rs==true)
{
    echo "<script type='text/javascript'>";    
    echo "window.location.href='index.php'";
    echo "</script>";
}
else   
{
    echo "<script type='text/javascript'>";  
    echo "alert('许愿失败！');";
    echo "window.location.href='index.php'";
    echo "</script>";
}
